﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SpotsHub.Tools.MassUploader.Forms
{
    public partial class ProductsReview : Form
    {
        public ProductsReview()
        {
            InitializeComponent();
        }

        public ProductGenerator Result { get; set; }

        private void ProductsReview_Load(object sender, EventArgs e)
        {
            if (Result != null)
            {
                dataGridView1.ReadOnly = true;
                dataGridView1.DataSource = Result.ProductsInformation;


                DataGridViewButtonColumn buttonColumn = new DataGridViewButtonColumn();
                buttonColumn.HeaderText = "";
                buttonColumn.Name = "Pictures";
                buttonColumn.Text = "Pictures";
                buttonColumn.UseColumnTextForButtonValue = true;

                dataGridView1.Columns.Add(buttonColumn);
            }
            else
            {
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                this.Close();
            }
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataGridView1.Columns.Count - 1)
            {
                int id = (int)Result.ProductsInformation.Rows[e.RowIndex][0];
                var dlg = new PictureReview();
                dlg.PictureFiles = Result.PictureFiles[id];
                dlg.ShowDialog();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }
    }
}
